<template>
  <el-select v-model="value" placeholder="请选择">
    <el-option
      v-for="dict in options"
      :key="dict.dictValue"
      :label="dict.dictLabel"
      :value="dict.dictValue"
      @change="handleChange"
    />
  </el-select>
</template>

<script>
export default {
  name: "DictSelect",
  props: {
    dictKey: {
      type: String,
      default: ''
    },
    value: {
      type: [String,Number],
      default: null
    }
  },
  data() {
    return {
      options: []
    }
  },
  created() {
    this.getDicts('sys_user_sex').then((response) => {
      this.options = response.data
    })
  },
  methods:{
    handleChange(val){
      this.$emit('input',val)
    }
  }
}
</script>

<style scoped>

</style>
